import * as socialSecurity from '@/api/social-security'
const state = {
  // 获取社保列表
  socialSecuritysList: {
    rows: [],
    total: 0
  },
  // 城市列表
  cityList: []
}

const mutations = {
  // 获取社保列表
  SET_SOCIAL_SECURITY_LIST: (state, newValue) => {
    state.socialSecuritysList = newValue
  },
  // 获取城市列表
  SET_CITY_LIST: (state, newValue) => {
    state.cityList = newValue
  }
}

const actions = {
  // 获取社保列表
  async updateSocialSecuritysList(ctx, data) {
    const res = await socialSecurity.getSocialSecuritys(data)
    ctx.commit('SET_SOCIAL_SECURITY_LIST', res)
  },
  async updateCityList(ctx, data) {
    const res = await socialSecurity.getCity(data)
    ctx.commit('SET_CITY_LIST', res)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
